home *** CD-ROM | disk | FTP | other *** search
/ CD Concept 6 / CD Concept 06.iso / mac / UTILITAIRE / RLaB / testmatrix / lehmer.r < prev    next >
Text File  |  1994-12-20  |  1KB  |  40 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Lehmer matrix - symmetric positive definite.
  4.  
  5. // Syntax:      A = lehmer ( N )
  6.  
  7. // Description:
  8.  
  9. //      A is the symmetric positive definite N-by-N matrix with
  10. //                     A(i,j) = i/j for j >= i.
  11. //      A is totally nonnegative.  INV(A) is tridiagonal, and explicit
  12. //      formulas are known for its entries. 
  13.  
  14. //      N <= COND(A) <= 4*N*N.
  15.  
  16. //      References:
  17. //        M. Newman and J. Todd, The evaluation of matrix inversion
  18. //           programs, J. Soc. Indust. Appl. Math., 6 (1958), pp. 466-476.
  19. //        Solutions to problem E710 (proposed by D.H. Lehmer): The inverse
  20. //           of a matrix, Amer. Math. Monthly, 53 (1946), pp. 534-535.
  21. //        J. Todd, Basic Numerical Mathematics, Vol. 2: Numerical Algebra,
  22. //           Birkhauser, Basel, and Academic Press, New York, 1977, p. 154.
  23.  
  24. //    This file is a translation of lehmer.m from version 2.0 of
  25. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  26. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  27.  
  28. //-------------------------------------------------------------------//
  29.  
  30. lehmer = function ( n )
  31. {
  32.   local (n)
  33.  
  34.   A = ones(n,1)*(1:n);
  35.   A = A./A';
  36.   A = tril(A) + tril(A,-1)';
  37.  
  38.   return A;
  39. };
  40.